/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package staffTests;

import java.util.Calendar;
import model.personInfo.Contacts;
import model.personInfo.Name;
import model.personInfo.Origin;
import model.staff.Person;
import model.staff.Student;
import org.junit.After;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;


/**
 *
 * @author Slayer
 */
public class PersonTest {
    private Person person;
    
    private final Name name;
    private final Origin origin;
    private final Contacts contacts;
    
    public PersonTest() {
        name = new Name("Dmitri", "Paziy");
        origin = new Origin(Calendar.getInstance().getTime(), "Kriviy Rig");
        contacts = new Contacts("12345", "Kyiv");
    }
    
    @Before
    public void setUp() {
        person = new Student(name, origin, contacts);
    }
    
    @After
    public void tearDown() {
    }
    
    @Test(expected=IllegalArgumentException.class)
    public void shouldThrowIllegalArgumentExceptionWhenNullArgumentToConstructor() {
        person = new Student(null, null, null);
    }
    
    @Test
    public void testGetName() {
        //given
        Name expected = name;
        //then
        assertEquals(expected, person.getName());
    }
    
    @Test
    public void testGetOrigin() {
        //given
        Origin expected = origin;
        //then
        assertEquals(expected, person.getOrigin());
    }
    
    @Test
    public void testGetContacts() {
        //given
        Contacts expected = contacts;
        //then
        assertEquals(expected, person.getContacts());
    }
    
    @Test
    public void testToString() {
        //given
        String expected = name.toString()
                + origin.toString()
                + contacts.toString();
        //then
        assertEquals(expected, person.toString());
    }
}
